package com.changy.ai_tutor_for_dm.mapper;

import com.changy.ai_tutor_for_dm.entity.Classes;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClassesMapper {

    @Insert("INSERT INTO classes(class_name, teacher_id, create_time, access_code) VALUES(#{className}, #{teacherId}, #{createTime}, #{accessCode})")
    void insert(Classes classes);

    @Select("SELECT * FROM classes WHERE teacher_id = #{cardId}")
    List<Classes> getClassesByCardId(@Param("cardId") String cardId);

}
